package Top200;

/**
 * @author zhangmin
 * @create 2022-02-24 14:59
 */
public class plusOne66 {
    public int[] plusOne(int[] digits) {
        int n=digits.length;
        for (int i = n-1; i >=0 ; i--) {
            if (digits[i]==9){
                digits[i]=0;
            }else {
                digits[i]++;
                return digits;
            }
        }
        int[] res=new int[n+1];
        res[0]=1;
        return res;
    }
}
